local Lua__Illution = fk.CreateSkill {
    name = "Lua__Illution",
    tags = {Skill.Permanent}
}


Fk:loadTranslationTable{
  ["Lua__Illution"] = "Illution",
  [":Lua__Illution"] = "持恒技，共鸣技，其他角色对你用牌时，你可以选择1~3名其他角色，然后将此牌目标随机改为你们4个中的一个。",
  ["#Lua__Illution-choose"] = "Illution：请选择1~3名角色，然后将此牌目标随机改为你们4个中的一个。",
}




Lua__Illution:addEffect(fk.CardUsing, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(Lua__Illution.name)  and table.contains(data.tos, player) and data.from ~= player and
        (player.general == "DIEND" or player.deputyGeneral == "DIEND")
    end,
    on_cost =function (self, event, target, player, data)
        local room = player.room
        local targets = room:askToChoosePlayers(player, {
            targets = room:getOtherPlayers(player),
            min_num = 1,
            max_num = 3,
            prompt = "#Lua__Illution-choose",
            skill_name = Lua__Illution.name,
            cancelable = true,
          })
          if #targets > 0 then
            event:setCostData(self, {target = targets})
            return true
          end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local target = event:getCostData(self).target
        table.insert(target, player)
        local ids = table.map(target, function(p) return p end)
        local to = ids[math.random(1, #ids)]
        data.tos = {to}
    end,
})




return Lua__Illution 